<?php

class Application_Form_AddOffer extends Zend_Form {

    public function init(){
    	
    	Zend_Dojo::enableForm($this);
    	   	 
		//Set the method for the display form to POST
        $this->setMethod('post');
 
		//product
		$this->addElement(new Application_Form_Element_ProductOfferSelect('id_product'));

        //date_begin
        $this->addElement(
        		'DateTextBox',
        		'begin',
        		array(
        				'label'          => 'Inceput:',
        				'id'			 => 'beginDateBox',
        				'required'       => true,
        				'invalidMessage' => 'Data invalida.',
        				'formatLength'   => 'long',
        				'style'			 =>'width: 100px;',
        				"dojoType"		 =>"dijit.form.DateTextBox",   				
        		)
        );
        
        //date_end
        $this->addElement(
        		'DateTextBox',
        		'end',
        		array(
        				'label'          => 'Sfarsit:',
        				'id'			 => 'endDateBox',
        				'required'       => true,
        				'invalidMessage' => 'Data invalida.',
        				'formatLength'   => 'long',
        				'style'			 =>'width: 100px;',
        				"dojoType"		 =>"dijit.form.DateTextBox",
        		)
        );
        
        //price reduction element       
        $this->addElement('text', 'price_reduction', array(
            'label' 	 => 'Reducere:',
        	'filters'    => array('StringTrim'),
            'required'	 => true,
        	'style'		 =>'width: 90px;',
        	'validators' => array(
        			array('StringLength', false, array(0, 3)),
        			'Float'
        	)
        ));
        
        // Add the submit button
        $this->addElement('submit', 'submit', array(
            'ignore'   => true,
            'label'    => 'Adauga Oferta',
        ));
    }
}

